package pl.edu.agh.xls2html.htmlelements;

import java.util.ArrayList;

import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class Row implements HTMLelement {
	private int len = 0;

	private ArrayList<Cell> cells;

	public Row(HSSFRow r, HSSFWorkbook wb, Document doc) {
		cells = new ArrayList<Cell>();
		len = r.getLastCellNum();

		for (int i = 0; i < len; i++)
			cells.add(new Cell(r.getCell(i), wb, doc));

	}

	@Override
	public String getHTML() {
		String content = "";
		for (Cell c : cells)
			content += c.getHTML();
		return HTMLHelper.makeRow(content);
	}

	@Override
	public String getCSS() {
		String css = "";
		for (Cell c : cells)
			css += c.getCSS();
		return css;
	}

	public int getRowLength() {
		return len;
	}

}
